import request from '@/utils/request'// request就是axios  @表示src目录
export default{
  // 1查询讲师列表
  list() {
    return request({ // 结果查完返回结果给list.vue
      url: '/admin/edu/teacher/list', // 访问的接口地址，和request中的baseURL进行拼接
      method: 'GET'
    })
  },
  page(pageNum, pageSize) {
    return request({
      url: `/admin/edu/teacher/list/${pageNum}/${pageSize}`,
      method: 'GET'
    })
  },
  // 2新增讲师
  save(teacher) {
    return request({
      url: '/admin/edu/teacher/add',
      method: 'POST',
      data: teacher
    })
  },
  // 3删除讲师
  deleteById(id) {
    return request({
      url: `/admin/edu/teacher/delete/${id}`,
      method: 'DELETE'
    })
  },
  // 4条件分页查询
  pageByCondition(pageNum, pageSize, searchObj) {
    return request({
      url: `/admin/edu/teacher/list/${pageNum}/${pageSize}`,
      method: 'GET',
      params: searchObj
    })
  },
  queryById(id) {
    return request({
      url: `/admin/edu/teacher/queryById/${id}`,
      method: 'GET'
    })
  },
  // 5更新讲师
  update(teacher) {
    return request({
      url: '/admin/edu/teacher/update',
      method: 'PUT',
      data: teacher
    })
  }
}
